import {Session} from "/@/utils/storage";

export const tableOption = {
    border: true,
    index: true,
    indexLabel: '序号',
    stripe: true,
    menuAlign: 'center',
    align: 'center',
    labelWidth: '160',
    searchMenuSpan: 4,
    indexWidth: '60',
    columnBtn: false,
    searchEnter:true,
    editBtn:false,
    selection:true,
    delBtn:false,
    searchSpan:6,
    menuWidth:200,
    searchLabelWidth: 'auto',
  searchMenuPosition: 'left',
    column: [
        {
            type: 'input',
            label: '事件编码',
            prop: 'eventNo',
            overHidden: true,
            addDisplay: false,
            editDisplay: false,
            width: 150,
        },
        {
            type: 'select',
            label: '事件来源',
            prop: 'sourceOfEvent',
            dicUrl: '/api/admin/omodict/item/select?dictKey=event_from',
            dicHeaders: {
                authorization: 'Bearer ' + Session.get('token'),
            },
            props: {
                label: 'label',
                value: 'value'
            },
            width: 150,
            search: true
        },
        {
            type: 'input',
            label: '事件名称',
            prop: 'eventName',
            width: 150,
            overHidden: true,
            search: true,
            rules: [
                {
                    required: true,
                    message: '请输入事件名称',
                    trigger: 'blur'
                }
            ]
        },
        {
            label: '关联工单',
            addDisplay: false,
            editDisplay: false,
            prop: 'associateTickets',
            width: 200,
            overHidden: true,
        },
        {
            type: 'select',
            label: '处理状态', //0：未处理，1：事件挂起，2：事件关闭，3：已生成工单，4：已评价
            prop: 'eventStatus',
            dicUrl: '/api/admin/omodict/item/select?dictKey=event_status',
            dicHeaders: {
                authorization: 'Bearer ' + Session.get('token'),
            },
            width: 150,
            search: true,
            addDisplay:false,
            editDisplay: false,
        },
        {
            type: 'input',
            label: '报修人',
            prop: 'eventUserName',
            search:true,
            // searchLabelWidth: '100',
            rules: [
                {
                    pattern: /^[\u4e00-\u9fa5]{2,6}$/,
                    message: '请输入正确姓名格式',
                    trigger: 'blur'
                }
            ],
            width: 150
        },
        {
            type: 'input',
            label: '报修人电话',
            prop: 'eventUserPhone',
            rules: [
                {
                    pattern: /^1[3456789]\d{9}$/,
                    message: '请输入正确手机号',
                    trigger: 'blur'
                }
            ],
            width: 150
        },
        {
            label: '设备名称',
            prop: 'equipName',
            search:true,
            width: 150,
            overHidden: true,
        },
        {
            type: 'input',
            label: '设备编号',
            prop: 'equipNo',
            width: 150,
            hide:true,
            addDisabled: true,
            editDisabled: true,
            overHidden: true,
        },

        {
            label: '事件区域',
            prop: 'eventArea',
            hide:true,
            width: 150,
            overHidden: true,
            rules: [
                {
                    required: true,
                    message: '请选择区域',
                    trigger: 'blur'
                }
            ]
        },
        {
            type: 'textarea',
            label: '故障描述',
            prop: 'eventDesc',
            width: 150,
            span: 24,
            overHidden: true
        },
        {
            label: '上传图片',
            prop: 'fileList',
            hide: true,
            dataType: 'array',
            span: 24
        },
        {
            type: 'tree',
            label: '处理人部门',
            prop: 'handleUserDeptId',
            filterable: true,
            width: 100,
            props: {
                label: 'name',
                value: 'id'
            },
            cascader: ['handleUserId'],
            dicUrl: `/api/admin/dept/tree`,
            dicHeaders: {
                authorization: 'Bearer ' + Session.get('token'),
            },
            hide: true,
            addDisplay: false,
            editDisabled: true
        },
        {
            type: 'input',
            label: '处理人',
            prop: 'handleUserName',
            addDisplay: false,
            editDisabled: true,
            hide:true,
            width: 150
        },
        {
            type: 'datetime',
            label: '处理时间',
            prop: 'handleTime',
            width: 180,
            addDisplay: false,
            hide:true,
            editDisabled: true
        }
    ]
}
export const tableOption3 = {
    border: true,
    index: false,
    indexLabel: '序号',
    stripe: true,
    menuAlign: 'center',
    align: 'center',
    searchMenuSpan: 6,
    menuWidth: 238,
    labelWidth: '130',
    indexWidth: '60',
    menu: false,
    addBtn: false,
    columnBtn: false,
    searchShowBtn: false,
    refreshBtn: false,
    selection: false,
    cellBtn: true,
    column: [
        {
            label: '序号',
            prop: 'radio',
            width: 60,
            hide: false
        },
        {
            // type: 'tree',
            label: '系统名称',
            prop: 'modelType2',
            search: true,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            searchSpan: 4
        },
        {
            // type: 'tree',
            label: '安装区域',
            prop: 'placeno',
            dicUrl: `/bm/bamssubarea/tree?lazy=false`,
            dicMethod: 'get',
            props: {
                label: 'name',
                value: 'id'
            },
            rules: [
                {
                    required: true,
                    message: '请选择安装区域',
                    trigger: 'blur'
                }
            ]
        },
        {
            // type: 'input',
            label: '设备位置编码',
            prop: 'unitNo',
            overHidden: true,
            hide: true
        },

        {
            // type: 'select',
            label: '资产类型',
            search: true,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            prop: 'deviceType',
            searchSpan: 4
        },
        {
            // type: 'select',
            label: '资产型号',
            search: true,
            hide: true,
            addDisplay: false,
            editDisplay: false,
            prop: 'devType2',
            searchSpan: 4
        },
        {
            label: '资产栏目',
            prop: 'modelType',
            hide: true
        },

        {
            // type: 'select',
            label: '资产类型',
            prop: 'unmodel',
            hide: true,
            editDisabled: true
        },
        {
            // type: 'select',
            label: '资产型号',
            // addDisabled: true,
            prop: 'devType',
            dicUrl: `/bm/bamaassetsmodel/getAssetsModelBy`,
            dicMethod: 'post',
            props: {
                label: 'bamAAssetsModelCn',
                value: 'bamAAssetsDeviceCode'
            },

            rules: [
                {
                    required: true,
                    message: '请选择资产类型',
                    trigger: 'blur'
                }
            ]
        },
        {
            // type: 'input',
            label: '资产名称',
            prop: 'assetsName',
            rules: [
                {
                    required: true,
                    message: '请选择资产名称',
                    trigger: 'blur'
                }
            ],
            hide: true,
            // formslot: true,
            // slot: true
            addDisplay: true,
            editDisplay: false,
            overHidden: true
        },
        {
            // type: 'input',
            label: '设备名称',
            prop: 'deviceName',
            search: true,
            searchSpan: 4
        },

        {
            type: 'input',
            label: '设备编号',
            prop: 'deviceNo',
            hide: true,
            addDisplay: true,
            editDisplay: true,
            addDisabled: true,
            editDisabled: true
        },

        {
            type: 'input',
            label: '安装位置描述',
            prop: 'placeremark'
        },

        {
            type: 'input',
            label: '设备sn码',
            prop: 'unitsn',
            rules: [
                {
                    pattern: /^[a-zA-Z0-9]+$/,
                    message: '请输入正确设备sn码，包含数字或英文',
                    trigger: 'blur'
                }
            ]
        },

        {
            type: 'select',
            // label: '在线离线状态：0离线，1在线',
            label: '在线状态',
            search: false,
            formatter: (val) => {
                return val.onlineStatus === 0 ? '离线' : '在线'
            },

            prop: 'onlineStatus',
            props: {
                label: 'label',
                value: 'value'
            },
            dicData: [
                {
                    label: '离线',
                    value: 0
                },
                {
                    label: '在线',
                    value: 1
                }
            ],
            addDisplay: false,
            editDisabled: true,
            placeholder: null
        },
        {
            type: 'select',
            // label: '工作状态，0-关机 1-开机 2-故障',
            label: '工作状态',
            formatter: (val) => {
                return val.workingStatus === 0 ? '关机' : val.employStatus === 1 ? '开机' : '故障'
            },
            // search: true,
            prop: 'workingStatus',
            props: {
                label: 'label',
                value: 'value'
            },
            dicData: [
                {
                    label: '关机',
                    value: 0
                },
                {
                    label: '开机',
                    value: 1
                },
                {
                    label: '故障',
                    value: 2
                }
            ],
            addDisplay: false,
            editDisabled: true
        },
        {
            type: 'input',
            label: '故障码',
            prop: 'errorStatus',
            addDisplay: false,
            hide: true
        },
        {
            type: 'input',
            label: '上线时间',
            prop: 'onlinedate',
            addDisplay: false,
            editDisplay: false,
            width: '160',
            hide: true
        }
    ]
}